home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / sap.arc / SAMPLE.C < prev    next >
C/C++ Source or Header  |  1988-04-04  |  1KB  |  64 lines

  1. /*****************************************************************************
  2.  *
  3.  * Program Name:  SAMPLE
  4.  *
  5.  * Filename:      sample.c
  6.  *
  7.  * Date Created:  March 22, 1988
  8.  *
  9.  * Programmers:      Bryan Sparks
  10.  *
  11.  * Files used:      sap.c, comm.h, sapa.asm
  12.  *
  13.  * Comments:      This program demonstrates how to ADVERTISE using 
  14.  *                  the Service Advertising Protocol.  The functions
  15.  *                  SAP.OBJ and SAPA.OBJ can be "plugged-in" to your
  16.  *                  program to do Service Advertising.
  17.  *
  18.  ****************************************************************************/
  19.  
  20. main(argc,argv)
  21. int argc;
  22. char *argv[];
  23. {
  24.     int                ccode;
  25.     unsigned int    ServerType;
  26.     char            ServerName[48];
  27.     unsigned int    ServerSocket=0x1111;    /* This would be your socket number. */
  28.  
  29.  
  30.     switch (argc) {
  31.     case 3:
  32.         strcpy( ServerName, argv[1] );
  33.         ConvertToUpper( ServerName, ServerName );
  34.         ServerType = atoi( argv[2] );
  35.         break;
  36.     default:
  37.         printf("\nusage: sap <server_name> <server_type_number>\n\n");
  38.         exit (-1);
  39.         break;
  40.     }
  41.  
  42.  
  43.     StartSAPOscillationRoutines( ServerName,
  44.             ServerType,
  45.             ServerSocket );
  46.  
  47.     printf("This machine is now ADVERTISING.\n\nPress any key to quit...");
  48.  
  49.     while (!kbhit())
  50.         ;
  51.  
  52.     printf("\nCanceling SAP...");
  53.     ccode = StopSAPOscillationRoutines( ServerName,
  54.                 ServerType,
  55.                 ServerSocket );
  56.     if (ccode)
  57.         printf("\rHad problems stopping SAP routines.\n");
  58.     else
  59.         printf("\rSAP routines canceled.\n");
  60.  
  61.  
  62. }
  63.  
  64.